package com.wondersgroup.framework.sample.component.grid.action;

import java.util.ArrayList;
import java.util.List;

import com.wondersgroup.framework.core.bo.Page;
import com.wondersgroup.framework.core.web.struts2.action.BaseAjaxAction;
import com.wondersgroup.framework.core.web.vo.VOUtils;
import com.wondersgroup.framework.sample.component.data.SelfDefinitionGridData;
import com.wondersgroup.wssip.util.RequestUtils;

public class SelfDefinitionGridAction extends BaseAjaxAction {

	@Override
	public String operate() {
		String result = prefix + suffex;
		return result;
	}

	public String initPage() {
		List<SelfDefinitionGridData> list = new ArrayList<SelfDefinitionGridData>();
		int initPageSize = RequestUtils.getParameter(servletRequest,
				"initPageSize", 25);
		for (int i = 1; i <= initPageSize; i++) {
			list.add(new SelfDefinitionGridData());
		}
		Page page = new Page(1, list.size(), list.size(), 1, list);
		String json = VOUtils.getJsonDataFromPage(page,
				SelfDefinitionGridData.class);
		createJSonData(json);
		return AJAX;
	}
}
